package com.example.lj.uav.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.lj.uav.R;

import java.util.List;

import dji.common.flightcontroller.flyzone.FlyZoneInformation;

public class DissolutionHistoryAdapter extends RecyclerView.Adapter<DissolutionHistoryAdapter.DHHolder> {

    private Context context;
    private List<FlyZoneInformation> list;

    public DissolutionHistoryAdapter(Context context, List<FlyZoneInformation> list) {
        this.context = context;
        this.list = list;
    }


    @Override
    public DHHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_dissolutionhistory,null);
        return new DHHolder(view);
    }

    @Override
    public void onBindViewHolder(DHHolder holder, int position) {
        FlyZoneInformation flyZoneInformation = list.get(position);
        holder.name.setText(flyZoneInformation.getName());
        holder.type.setText(flyZoneInformation.getFlyZoneType().toString());
        holder.time.setText(flyZoneInformation.getEndTime());
        holder.status.setText(flyZoneInformation.getCategory().toString());
    }

    @Override
    public int getItemCount() {
        return 0;
    }

    class DHHolder extends RecyclerView.ViewHolder {

        private TextView name;
        private TextView type;
        private TextView time;
        private TextView status;

        public DHHolder(View itemView) {
            super(itemView);
            name = itemView.findViewById(R.id.item_dh_name);
            type = itemView.findViewById(R.id.item_dh_type);
            time = itemView.findViewById(R.id.item_dh_time);
            status = itemView.findViewById(R.id.item_dh_status);
        }
    }
}
